<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    a {
      font-size: 20px;
      text-decoration: none;
      color: black;
    }
  </style>
</head>

<body>
  <a href="https://www.baidu.com/">支付成功<span>5</span>秒后自动跳转页面</a>
  <script>
    const a = document.querySelector('a')
    let orgin = 5
    let timerId = setInterval(function () {
      orgin--
      console.log(orgin);
      a.innerHTML = `支付成功<span>${orgin}</span>秒后自动跳转页面`
      if (orgin === 0) {
        clearInterval(timerId)
        location.href = 'https://www.baidu.com/'
      }
    }, 1000)

  </script>
</body>

</html>